// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   LogoutAction.java

package com.boci.clientapp.authentication.action;

import com.boci.clientapp.authentication.LoginPanel;
import com.boci.clientapp.authentication.handler.LoginHandler;
import com.boci.clientapp.authentication.vo.LoginVO;
import com.boci.clientapp.main.ApplicationService;
import com.boci.clientapp.main.MainPanel;
import com.boci.common.action.AbstractAction;
import com.boci.common.constant.RequestTypeConst;
import com.boci.common.handler.StaticConnectionParam;
import com.boci.common.util.AppException;
import com.boci.common.util.StringUtil;
import java.util.HashMap;
import java.util.logging.Logger;

public class LogoutAction extends AbstractAction
{

    public LogoutAction()
    {
    }

    public void doProcess(HashMap pInpMap, String pActionType)
    {
    	try{
	        appServ.setBusy(true);
	        if(pActionType.equals("LOGOUT"))
	        {
	            if(appServ.showYesNoDialog(null, "MAIN.CONFIRM_LOGOUT"))
	            {
	                String strReqType = RequestTypeConst.BOCI_LOGOUT_URL;
	                LoginHandler loginHandler = new LoginHandler(strReqType);
	                LoginVO loginVO = (LoginVO)loginHandler.logout(pInpMap);
	                appServ.logout();
	                appServ.getMainPanel().showLoginPanel(true);
	                appServ.getMainPanel().getLoginPanel().refresh();
	                StaticConnectionParam.getInstance().setStrEncPass(null);
	            } else
	            {
	                appServ.setFocus();
	            }
	        } else
	        if(pActionType.equals("EXIT") && appServ.getUserID() != null && appServ.getUserID().length() > 0)
	        {
	            String strReqType = RequestTypeConst.BOCI_LOGOUT_URL;
	            LoginHandler loginHandler = new LoginHandler(strReqType);
	            LoginVO loginVO = (LoginVO)loginHandler.logout(pInpMap);
	            appServ.logout();
	            StaticConnectionParam.getInstance().setStrEncPass(null);
	        }
    	}catch(AppException appEx){
            logger.info(StringUtil.formatException(appEx));
            appServ.showErrorDialog(null, appEx.getMessage());   		
    	}catch(Exception sysEx){
            logger.severe(StringUtil.formatException(sysEx));
            appServ.showSysErrDialog();  		
    	}finally{
    		appServ.setBusy(false);
    	}
    	return;
    }
}
